﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Samples.Kinect.SwipeGestureRecognizer;
using Microsoft.Kinect;
using BT.Kinect;
using Microsoft.Xna.Framework;

namespace BT.Kinect
{
    class SwapHand : GameComponent
    {
       // public String flagy = "false";
        public readonly Recognizer activeRecognizer;
         KinectInput kinect;
        public SwapHand(Game btGame) : base(btGame)
        {
          //  this.kinect = kinect;
            this.activeRecognizer = this.CreateRecognizer();
            btGame.Components.Add(this);
        }
        public override void Initialize()
        {
            //spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));

            kinect = (KinectInput)Game.Services.GetService(typeof(KinectInput));

            base.Initialize();
        }
        public Recognizer CreateRecognizer()
        {
            var recognizer = new Recognizer();
            recognizer.SwipeRightDetected += (s, e) =>
            {
              //  flagy = "true";
            };
            recognizer.SwipeLeftDetected += (s, e) =>
            {
              //  flagy = "true";
            };
            return recognizer;
        }
        public override void Update(GameTime gameTime)
        {
            if (kinect.Skeleton == null)
                activeRecognizer.Recognize(null, null, new Skeleton[] { });
            else
                activeRecognizer.Recognize(null, null, new Skeleton[] { kinect.Skeleton });
        }
    }
}
